<!--
* description: 目标客户
* author: liks
* createdDate: 2019-11-25
-->
<template>
  <section class="carTypeConfig">
    <el-dialog
      v-dialogDrag
      title="目标客户导入"
      :visible.sync="curPopupsVisible"
      width="1000px"
      center
      @close="sendCode"
      :close-on-click-modal="false"
      :append-to-body="true"
    >
      <dialogHeader slot="title" :title="'目标客户导入'" :styleType="$store.state.app.dialogType"></dialogHeader>
      <one-table-template
        ref="multipleTable"
        :dynamicButtons="tableButtons"
        :dynamicComponents="tableComponents"
        :dynamicApiConfig="apiConfig"
        :dynamicTableCols="tableCols"
        :dynamicFormFields="formField"
        :dynamicIsShowSelect="isMul"
      />
      <importCust
        ref="importCust"
        :dynamicEditRowData="importRowData"
        :popupsVisible="importPopupsVisible"
        :key="importPopupsKey"
        :popupsState="importPopupsState"
        @close="close"
      />
    </el-dialog>
  </section>
</template>
<script>
import { oneTableWithViewTemplateMixins } from "@/components/mixins/oneTableWithViewTemplateMixins";
import { valueObjectMixins } from "@/components/mixins/valueObjectMixins";
import { crmApis } from "@/api/apiList/crm";
import OneTableTemplate from "@/components/crm/commonComponents/crmPopupsOneTable";
import importCust from "./importCust";
export default {
  // 组件混入对象：{data[listQuery] methods[queryTable]}
  mixins: [oneTableWithViewTemplateMixins, valueObjectMixins],
  components: {
    OneTableTemplate,
    importCust,
    dialogHeader: () => import("@/components/dialogHeader") //弹窗标题
  },
  data() {
    return {
      // 网格查询API配置对象
      apiConfig: crmApis.mdmDlrCustInfoQueryGetCustList,
      // 动态组件-按钮
      tableButtons: [
        {
          compKey: "btnKey1",
          type: "",
          size: "small",
          clickEvent: () => this.queryTable(1),
          text: "查询",
          position: "top"
        },
        {
          compKey: "btnKey2",
          type: "",
          size: "small",
          clickEvent: () => this.reset(),
          text: "重置",
          position: "top"
        },
        {
          compKey: "btnKey3",
          type: "",
          size: "small",
          clickEvent: () => this.import(),
          text: "导入",
          position: "top"
        },
        {
          compKey: "btnKey4",
          type: "primary",
          size: "small",
          clickEvent: () => this.sendCode(this.codeField, "custName"),
          text: "确认",
          position: "bottom"
        }
      ],
      // 动态组件-查询条件
      tableComponents: [
        // 显示组件
        {
          compKey: "compKey1",
          labelName: "导入名称",
          codeField: "custName",
          component: () => import("@/components/org/commonInput"),
          type: "inputText",
          isMust: true
        },
        {
          compKey: "compKey2",
          labelName: "导入时间",
          codeField: "stratDate,endDate",
          component: () => import("@/components/crm/Time/crmdtDatePicker"),
          type: "inputText",
          isMust: true
        }
      ],
      // 动态生成网格列
      tableCols: [
        { prop: "carBrandName", label: "批次号", width: null, align: "center" },
        { prop: "custName", label: "导入名称", width: null, align: "center" },
        { prop: "phone", label: "导入时间", width: null, align: "center" },
        { prop: "phone", label: "总客户数", width: null, align: "center" }
      ],
      //表单查询数据（查询条件）
      formField: {
        custName: "",
        stratDate: "",
        endDate: "",
        oemCode: "1",
        groupCode: "1"
      }
    };
  },
  methods: {
    import() {
      this.$refs.importCust.visible = true;
    }
  }
};
</script>
